package translator.frontend;

import java.io.IOException;

import org.antlr.runtime.*;

import translator.grammar.*;

import translator.objects.*;

public class Translator {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		String filename = "sample.txt";
		Algorithm alg = null;
		try {
			CharStream cs = new ANTLRFileStream(filename);
			AppLexer lexer = new AppLexer(cs);
			CommonTokenStream tokens = new CommonTokenStream();
			tokens.setTokenSource(lexer);
			AppParser parser = new AppParser(tokens);
			alg = parser.algo();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (RecognitionException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		alg.generateCode(null);

	}

}
